package com.web.controller;

import com.dto.BaseDto;
import com.entity.Platformactivityrecod;
import com.page.PageInfo;
import com.web.service.PlatformactivityrecodService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
@RequestMapping("/platformactivityrecodController")
public class PlatformactivityrecodController {
    @Resource
    PlatformactivityrecodService platformactivityrecodService;

    @RequestMapping("/platformactivityrecods")
    @ResponseBody
   public BaseDto<Platformactivityrecod> getAll() throws Exception{
        return platformactivityrecodService.getAll();
   }

    @RequestMapping("/platformactivityrecods/page")
    public ModelAndView getCustomersByPage(PageInfo pageInfo) throws Exception{
        BaseDto<Platformactivityrecod> dto = platformactivityrecodService.getPlatformactivityrecodsByPage(pageInfo);

        return new ModelAndView("/back/platformactivityrecod/list", "dto", dto);
    }

    @RequestMapping("/platformactivityrecods/page/json")
    @ResponseBody
    public BaseDto<Platformactivityrecod> getCustomersByPageJson(PageInfo pageInfo) throws Exception{
        return platformactivityrecodService.getPlatformactivityrecodsByPage(pageInfo);
    }

    @PostMapping("/platformactivityrecod/post")
    @ResponseBody
    public BaseDto<Platformactivityrecod> add(Platformactivityrecod platformactivityrecod) throws Exception{
        return platformactivityrecodService.add(platformactivityrecod);
    }

    @PutMapping("/platformactivityrecod/put/{parid}")
    @ResponseBody
    public BaseDto<Platformactivityrecod> update(@PathVariable("parid") int parid) throws Exception{
        return  platformactivityrecodService.update(parid);
    }

    @PostMapping("/platformactivityrecod/post1")
    @ResponseBody
    public BaseDto<Platformactivityrecod> addByFestival(Platformactivityrecod platformactivityrecod) throws Exception{
        return platformactivityrecodService.addByFestival(platformactivityrecod);
    }

}
